package com.tinyseed.emcp.api.basicdata.domain;

import com.tinyseed.hmxx.admin.system.domain.Dept;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;
import java.util.Set;

/**
 * tb_organize
 *
 * @author tinyCode
 * @date 2019-11-22 21:42:01
 */
@Data
@Table(name = "tb_organize")
@Entity()
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Organize implements Serializable {

    /**
     * 主键
     */
    @Id
    @GeneratedValue
    @Column(name = "id")
    private Long id;
    /**
     * 组织机构
     */
    @Column(name = "organize_name")
    private String organizeName;
    /**
     * 父级id
     */
    @Column(name = "parent_id", nullable = true)
    private Long parentId;
    /**
     * 创建时间
     */
    @Column(nullable = true)
    private Timestamp createTime;

    @ManyToMany(cascade={CascadeType.ALL},fetch =FetchType.EAGER)
    @JoinTable(name="tb_organize_depts",joinColumns=@JoinColumn(name="organize_id"),inverseJoinColumns=@JoinColumn(name="dept_id"))
    private Set<Dept> dept;


    /**
     * 最后修改时间
     */
    @Column(nullable = true)
    private Timestamp modifyTime;
    /**
     * 创建人
     */
    @Column(nullable = true)
    private String creator;
    /**
     * 最后操作人
     */
    @Column(nullable = true)
    private String modifier;
}
